package com.xiaoy.util;

public class StringUtil {
	
//	public boolean isEmpty (String string) {
//		if (string != null && "".equals(string)) {
//			
//		}
//	}
	
	/**
	 * object 转值
	 * @param object
	 * @return
	 */
	public static String toString (Object obj) {
		if (obj !=null){
			return obj.toString();
		}
		return "";
	}
	
	public static long[] toLong (String str[]) {
		if(str == null || str.length==0) {
			return new long[]{};
		}else {
			long[] ls = new long[str.length];
			int i = 0;
			for (String s : str) {
				ls[i++] = Long.parseLong(s);
			}
			return ls;
		}
	}
	public static String toJsonAttr(String key ,Object value){
		
		return "\""+key+"\":\""+value+"\"";
	}
	
	public static String toJsonAttrWithObj(String key ,Object value){
		
		return "\""+key+"\":"+value;
	}
}
